package com.jctrip.hotel.source.controller;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import org.apache.commons.lang3.time.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.jctrip.hotel.source.model.hworld.HworldCallBackRequestBody;
import com.jctrip.hotel.source.service.hworld.HworldTaskService;

import lombok.extern.slf4j.Slf4j;

/**
 * @Author henry
 * @Date 2023/7/4 12:53
 * @Description
 */
@RestController
@RequestMapping("hworld/callback")
@Slf4j
public class HworldCallBackController {

    @Autowired
    private HworldTaskService hworldTaskService;

    @PostMapping(value = "/price")
    public Map<String, String> priceCallback(@RequestBody HworldCallBackRequestBody req) {
        Map result = new HashMap<>();
        result.put("code", "200");
        result.put("message", "成功!");
        try {
            hworldTaskService.syncHworldReateCallBackProcess(req);
        } finally {
            return result;
        }
    }

    @PostMapping(value = "room")
    public Map<String, String> roomCallback(@RequestBody HworldCallBackRequestBody req) {
        Map result = new HashMap<>();
        result.put("code", "200");
        result.put("message", "成功!");
        try {
            hworldTaskService.syncHworldReateCallBackProcess(req);
        } finally {
            return result;
        }
    }
}
